﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="userlist.aspx.cs" Inherits="WebApplication1.userlist" MasterPageFile="~/masterpage/User.Master" %>

<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">

    <%--Begin Loading ajax section--%>
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" EnablePartialRendering="true">
    </asp:ScriptManager>
    <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
        <ProgressTemplate>
            <div id="divProgress" style="position: fixed; text-align: center; height: 100%; width: 100%; top: 0; right: 0; left: 0; z-index: 9999999; background-color: #000000; opacity: 0.7;">
                <div class="center">

                    <img alt="" src="images/loading.gif" />

                </div>
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
    <div id="divProgress" style="position: fixed; text-align: center; height: 100%; width: 100%; top: 0; right: 0; left: 0; z-index: 9999999; background-color: #000000; opacity: 0.7; display: none">
        <div class="center">

            <img alt="" src="images/loading.gif" />
        </div>







    </div>
    <%--End Loading ajax section--%>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always">
        <ContentTemplate>
            <div class="container-fluid">

                <fieldset>
                    <legend>User List </legend>
                    <!-- Alert Message -->
                    <asp:Panel ID="divMessage" runat="server" class="alert alert-danger  alert-dismissible" Visible="False" role="alert">
                        <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                        <asp:Label ID="lblMessage" runat="server" Text="">
                         
                        </asp:Label>
                    </asp:Panel>
                </fieldset>
                <asp:EntityDataSource ID="edsRole" runat="server" ConnectionString="name=FosIntelEntities" DefaultContainerName="FosIntelEntities" EnableFlattening="False" EntitySetName="fos_Role">
                </asp:EntityDataSource>
                <asp:ListView ID="lsvUsers" runat="server" OnPagePropertiesChanging="lsvUsers_PagePropertiesChanging" OnItemEditing="lsvUsers_ItemEditing" OnItemCanceling="lsvUsers_ItemCanceling">
                    <EmptyDataTemplate>
                        <table runat="server" style="">
                            <tr>
                                <td>No data was returned.</td>
                            </tr>
                        </table>
                    </EmptyDataTemplate>
                    <EditItemTemplate>
                        <tr style="">
                            <td></td>
                            <td>
                                <asp:Label ID="lblName" runat="server" Text='<%# Eval("Name") %>' />
                            </td>

                            <td colspan="4">
                                <asp:DropDownList ID="ddlRole" runat="server" ClientIDMode="AutoID" DataSourceID="edsRole" DataTextField="RoleName" DataValueField="Id" class="form-control" AutoPostBack="true"></asp:DropDownList>
                                <asp:ImageButton ID="btnAddRole" runat="server" ImageUrl="~/images/add.jpg" Height="20px" Width="20px" ClientIDMode="AutoID" OnClick="btnAddRole_Click" CommandArgument='<%# Eval("Id") %>' />
                            </td>
                            <td>
                                <asp:Repeater ID="Repeater1" runat="server" DataSource='<%# Eval("fos_UserLinkRole") %>'>
                                    <HeaderTemplate>
                                        <ul>
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <li runat="server" visible='<%# !Convert.ToBoolean(Eval("isDeleted")) %>'><%# Eval("fos_Role.RoleName") %>   

                                               <asp:LinkButton ID="LinkButton1" runat="server" ClientIDMode="AutoID" CommandArgument='<%# Eval("Id") %>'  OnClick="btnDelete_Click">[x]</asp:LinkButton>
                                        </li>
                                    </ItemTemplate>

                                    <FooterTemplate></ul></FooterTemplate>

                                </asp:Repeater>

                            </td>
                            <td>
                                <%--      <asp:Button ID="UpdateButton" runat="server" class="btn btn-primary" CommandName="Update" Text="Update" />--%>
                                <asp:Button ID="CancelButton" runat="server" class="btn btn-primary" CommandName="Cancel" Text="Cancel" />
                            </td>


                        </tr>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <tr style="">
                            <td>
                                <asp:Label ID="lblNo" runat="server" Text='<%# Container.DataItemIndex +1  %>' />
                            </td>
                            <td>
                                <asp:Label ID="lblName" runat="server" Text='<%# Eval("Name") %>' />
                            </td>
                            <td>
                                <asp:Label ID="lblPhone" runat="server" Text='<%# Eval("Phone") %>' />
                            </td>
                            <td>
                                <asp:Label ID="lblEmail" runat="server" Text='<%# Eval("Email") %>' />
                            </td>
                            <td style="text-align: center">
                                <asp:CheckBox ID="chkAcitve" runat="server" Checked='<%# Convert.ToBoolean(Eval("IsActive")) == true ? true : false %>' Enabled="False" />

                            </td>
                            <td style="text-align: center">
                                <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Convert.ToBoolean(Eval("IsDeleted")) %>' Enabled="False" />

                            </td>
                            <td>

                                <asp:Repeater ID="Repeater1" runat="server" DataSource='<%# Eval("fos_UserLinkRole") %>'>
                                    <HeaderTemplate>
                                        <ul>
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <li runat="server" visible='<%# !Convert.ToBoolean(Eval("isDeleted")) %>' ><%# Eval("fos_Role.RoleName") %> 

                                          
                                        </li>
                                       
                                    </ItemTemplate>

                                    <FooterTemplate></ul></FooterTemplate>

                                </asp:Repeater>
                            </td>
                            <td style="text-align: center">
                                <asp:Button ID="EditButton" runat="server" class="btn btn-primary" CommandName="Edit" Text="Edit" />

                            </td>

                        </tr>
                    </ItemTemplate>
                    <LayoutTemplate>



                        <table id="itemPlaceholderContainer" runat="server" border="0" class="table table-hover table-bordered">
                            <tr runat="server" class="info">

                                <th runat="server">No</th>
                                <th runat="server">Name</th>


                                <th runat="server">Phone</th>
                                <th runat="server">Email</th>
                                <th runat="server">Active</th>
                                <th runat="server">Deleted?</th>
                                <th runat="server">Role</th>
                                <th runat="server">Edit Role</th>


                            </tr>
                            <tr id="itemPlaceholder" runat="server">
                            </tr>



                        </table>
                    </LayoutTemplate>
                </asp:ListView>
                <asp:DataPager ID="dp" runat="server" PagedControlID="lsvUsers" ClientIDMode="AutoID">
                    <Fields>
                        <asp:NumericPagerField />

                    </Fields>
                </asp:DataPager>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>


</asp:Content>


